feat(backup): one vault directory per stacklet - #88
Merged
Merged
Conversation
The vault gave every source a flat directory, data/photos-library. Both halves of a source id can contain hyphens, so that name cannot be split back into stacklet and source. Sources now land under their stacklet: data/photos/library, data/messages/synapse, which also puts everything that has to be restored together in one place. Disks written by 0.3.0-beta.3 and earlier go on working. A sync uses whichever directory it finds, so nothing is ever copied twice and no vault has to be touched at all. `stack backup migrate` performs the one-time rename when the household is ready; it moves directories rather than their contents, so no data is copied and the files keep the immutable flag that makes the vault append-only.
The immutable-flag test shells out to chflags, which only exists on BSD, so it failed on the Linux CI runner. The rest of the file is plain path handling and still runs everywhere.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backup sources now land in
data/<stacklet>/<name>on the vault:data/photos/libraryinstead ofdata/photos-library. Everything belonging to one stacklet restores from one place, and a hyphen inside a stacklet id or a source name is no longer ambiguous.Existing vaults keep working untouched. A sync that finds the old flat directories goes on appending to them and prints one line per source pointing at the new command, so nothing is ever copied twice.
stack backup migratedoes the one-time rename,--dry-runto preview. It renames the directories rather than their contents, so a 65k-file photo library moves in about a second and the immutable flags survive. Run it with the disk mounted, right after a sync.